<?php
class AjaxAction extends HomeAction{
    public function verify() {    
		import("ORG.Util.Image");    
		Image::buildImageVerify(4,1,'png',58,28,'verify');     
    }
    /**
     * 根据id获取地区
     */
    public function area(){
    	$pid = trim($_GET['pid']);
    	if(!is_numeric($pid))exit;
    	$where = "pid = $pid";
    	$dep_list = M('area')->where($where)->field('id,pid,name')->findAll();
    	echo json_encode($dep_list);
    }
    public function upload(){
    	import('ORG.Net.UploadFile'); 
		$upload = new UploadFile(); 								// 实例化上传类 
		$upload->maxSize	= 3145728 ; 								// 设置附件上传大小 
		$upload->allowExts	= array('jpg', 'gif', 'png', 'jpeg','bmp'); 	// 设置附件上传类型 
		$upload->savePath	= './Public/Uploads/'; 					// 设置附件上传目录 
		$upload->autoSub	= true;
		$upload->subType	= 'date';
		$upload->dateFormat	= 'Y-m-d';
		$upload->saveRule	= 'uniqid';
		if(!$upload->upload()) { // 上传错误 提示错误信息 
			$this->error($upload->getErrorMsg()); 
		}else{ // 上传成功 获取上传文件信息 
			$info = $upload->getUploadFileInfo(); 
			$Attachment = M('attachment');
			$Attachment->addAll($info);
		}
		echo $info[0]['savename'];
    }
}

?>